package cn.boy.web.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.boy.service.DormitoryService;
import cn.boy.service.DormitoryServiceFactory;

public class QueryDormitoryByPrexServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String prex = request.getParameter("no_prex");
		System.out.println("server prex---->>" + prex);
		
		DormitoryServiceFactory instance = DormitoryServiceFactory.getInstance();
		DormitoryService service = instance.getDormitoryService();
		String json = service.queryDormitoryByPrex(prex);
		
		response.getOutputStream().write(json.getBytes("UTF-8"));
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
		
	}

}
